package com.jianbing.shasha.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jianbing.common.annotation.Log;
import com.jianbing.common.core.controller.BaseController;
import com.jianbing.common.core.domain.AjaxResult;
import com.jianbing.common.enums.BusinessType;
import com.jianbing.shasha.domain.ShashaLevelSetting;
import com.jianbing.shasha.service.IShashaLevelSettingService;
import com.jianbing.common.utils.poi.ExcelUtil;
import com.jianbing.common.core.page.TableDataInfo;

/**
 * 每天能玩的小关Controller
 * 
 * @author ruoyi
 * @date 2024-06-09
 */
@RestController
@RequestMapping("/shasha/setting")
public class ShashaLevelSettingController extends BaseController
{
    @Autowired
    private IShashaLevelSettingService shashaLevelSettingService;

    /**
     * 查询每天能玩的小关列表
     */
//    @PreAuthorize("@ss.hasPermi('shasha:setting:list')")
    @GetMapping("/list")
    public TableDataInfo list(ShashaLevelSetting shashaLevelSetting)
    {
        startPage();
        List<ShashaLevelSetting> list = shashaLevelSettingService.selectShashaLevelSettingList(shashaLevelSetting);
        return getDataTable(list);
    }

    /**
     * 导出每天能玩的小关列表
     */
//    @PreAuthorize("@ss.hasPermi('shasha:setting:export')")
    @Log(title = "每天能玩的小关", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ShashaLevelSetting shashaLevelSetting)
    {
        List<ShashaLevelSetting> list = shashaLevelSettingService.selectShashaLevelSettingList(shashaLevelSetting);
        ExcelUtil<ShashaLevelSetting> util = new ExcelUtil<ShashaLevelSetting>(ShashaLevelSetting.class);
        util.exportExcel(response, list, "每天能玩的小关数据");
    }

    /**
     * 获取每天能玩的小关详细信息
     */
//    @PreAuthorize("@ss.hasPermi('shasha:setting:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(shashaLevelSettingService.selectShashaLevelSettingById(id));
    }

    /**
     * 新增每天能玩的小关
     */
    //  @PreAuthorize("@ss.hasPermi('shasha:setting:add')")
    @Log(title = "每天能玩的小关", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ShashaLevelSetting shashaLevelSetting)
    {
        return toAjax(shashaLevelSettingService.insertShashaLevelSetting(shashaLevelSetting));
    }

    /**
     * 修改每天能玩的小关
     */
    //  @PreAuthorize("@ss.hasPermi('shasha:setting:edit')")
    @Log(title = "每天能玩的小关", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ShashaLevelSetting shashaLevelSetting)
    {
        return toAjax(shashaLevelSettingService.updateShashaLevelSetting(shashaLevelSetting));
    }

    /**
     * 删除每天能玩的小关
     */
    // @PreAuthorize("@ss.hasPermi('shasha:setting:remove')")
    @Log(title = "每天能玩的小关", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(shashaLevelSettingService.deleteShashaLevelSettingByIds(ids));
    }
}
